package com.wss.day06.regex;

import java.util.Scanner;

/**
 * @author wangshaoshuai
 * @desc TODO
 * @date 2025/4/26
 */
public class Test5 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入手机号：");
        String phoneNum = sc.nextLine();

        if(phoneNum.length()!=11){
            System.out.println("该手机号不是11位！");
            return;
        }

        if(!phoneNum.matches("\\d+")){
            System.out.println("该手机号不都是数字");
            return;
        }

        char c1 = phoneNum.charAt(phoneNum.length() - 1);
        char c2 = phoneNum.charAt(phoneNum.length() - 2);
        char c3 = phoneNum.charAt(phoneNum.length() - 3);
        if(c1==c2 && c2==c3){
            System.out.println("手机号是靓号");
        }else{
            System.out.println("手机号合法但不是靓号");
        }
    }
}
